package com.wuuxiang.dynamic.mongo.database;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.LinkedHashMap;
import java.util.Map;

@ConfigurationProperties(prefix = DynamicMongoProperty.PREFIX)
public class DynamicMongoProperty {
    public static final String PREFIX = "spring.data.mongodb.dynamic";
    public static final String REMOVE_UNDER_CLASS = "remove-under-class";

    /**
     * 必须设置默认的库,默认master
     */
    private String primary;

    /**
     * 去掉_class字段
     */
    private Boolean removeUnderClass;

    /**
     * 每一个数据源
     */
    private Map<String, DynamicMongoProperties> datasource = new LinkedHashMap<>();


    public static final class DynamicMongoProperties {
        private String uri;

        public String getUri() {
            return uri;
        }

        public void setUri(String uri) {
            this.uri = uri;
        }
    }

    public String getPrimary() {
        return primary;
    }

    public void setPrimary(String primary) {
        this.primary = primary;
    }

    public Boolean getRemoveUnderClass() {
        return removeUnderClass;
    }

    public void setRemoveUnderClass(Boolean removeUnderClass) {
        this.removeUnderClass = removeUnderClass;
    }

    public Map<String, DynamicMongoProperties> getDatasource() {
        return datasource;
    }

    public void setDatasource(Map<String, DynamicMongoProperties> datasource) {
        this.datasource = datasource;
    }
}
